import socket

# 创建socket客户端
socket_client = socket.socket()

# 连接到服务器
socket_client.connect(("localhost", 8888))

# 发送消息
msg = input("请输入要发送的消息").encode("UTF-8")
socket_client.send(msg)

# 接收消息
data = socket_client.recv(1024).decode("UTF-8")
print(f"接收到服务端消息为:{data}")

